//
//  SecondLevelView.m
//  WangliBank
//
//  Created by Sidney on 14-4-25.
//  Copyright (c) 2014年 iSoftstone infomation Technology (Group) Co.,Ltd. All rights reserved.
//

#import "SecondLevelView.h"

@implementation SecondLevelView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

//清空UI所有UI以及Data
- (void)removeAllObject{
    
}

- (void)getServerData{
    
}

- (void)analyzeReceivedData:(id)data{
    
}

- (UIImageView *)createImageViewWithFrame:(CGRect)frame image:(UIImage *)image
{
    UIImageView * imageview = [[UIImageView alloc] initWithFrame:frame];
    imageview.image = image;
    return imageview;
}

//创建UIButton
- (UIButton *)createButtonWithFrame:(CGRect)frame title:(NSString *)title target:(SEL)tar
{
    UIButton * btn = [[UIButton alloc] initWithFrame:frame];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn addTarget:self action:tar forControlEvents:UIControlEventTouchUpInside];
    return btn;
}


//创建UILabel
- (UILabel *)createLableWithFrame:(CGRect)frame text:(NSString *)txt fontSize:(int)size
{
    UILabel * label = [[UILabel alloc] initWithFrame:frame];
    label.backgroundColor = [UIColor clearColor];
    label.textColor = [UIColor darkGrayColor];
    label.font = [UIFont boldSystemFontOfSize:size];
    label.textAlignment = NSTextAlignmentLeft;
    label.text = txt;
    return label;
}

//创建UITextField
- (UITextField *)createTextFieldWithFrame:(CGRect)frame text:(NSString *)txt fontSize:(int)size
{
    UITextField * textField = [[UITextField alloc] initWithFrame:frame];
    //    textField.borderStyle = UITextBorderStyleRoundedRect;
    textField.textColor = [UIColor darkGrayColor];
    textField.font = [UIFont systemFontOfSize:size];
    textField.textAlignment = NSTextAlignmentLeft;
    textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    textField.returnKeyType = UIReturnKeyNext;
    textField.text = txt;
    textField.clearButtonMode = UITextFieldViewModeWhileEditing;
    return textField;
}

- (void)showWithLabel:(NSString *)txt
{
    if (!txt)
        txt = @"正在加载...";
    if (!_loadingHub) {
        _loadingHub = [[MBProgressHUD alloc] initWithView:self];
//        _loadingHub.animationType = MBProgressHUDAnimationZoom;
    }
	[self addSubview:_loadingHub];
    
    if (![txt isEqualToString:@""]) {
        _loadingHub.labelText = txt;
    }
//	[_loadingHub showUsingAnimation:YES];
    [_loadingHub show:YES];

}

- (void)dismissHUD
{
//    [_loadingHub hideUsingAnimation:NO];
    [_loadingHub hide:NO];
    _loadingHub = nil;
}

- (void)showAlertView:(NSString *)title message:(NSString *)msg
{
    UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:title
                                                         message:msg
                                                        delegate:nil
                                               cancelButtonTitle:@"确定"
                                               otherButtonTitles:nil];
    [alertView show];
}

- (void)showToastWithMessage:(NSString *)message showTime:(float)interval
{
    TipLabel * tip = [[TipLabel alloc] init];
    [tip showToastWithMessage:message showTime:interval];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
